<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.ViewControleDocumentoTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:panelGroup id="messagePanel" styleClass="ajustaListaMensagemErro"  layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="list"/>
            </h:panelGroup>
            <!--<h:form>-->

            <p:growl id="messages" life="3000"/>

            <p:panel>
                <f:facet name="header">
                    <h:outputText value="#{bundle.LegendControleDocumentoTitle}"></h:outputText>    
                </f:facet>

                <h:panelGrid columns="2">
                    <ui:remove>
                        <h:outputText value="#{bundle.ViewControleDocumentoLabel_tcmId}"/>
                        <h:outputText value="#{controleDocumentoController.selected.tcmId}" title="#{bundle.ViewControleDocumentoTitle_tcmId}"/>
                    </ui:remove>

                    <h:outputLabel value="#{bundle.ViewUsinaLabel_usiProcesso}"/>

                    <h:outputLink styleClass="formataLink"  target="new"  id="linkProcesso" value="#{controleDocumentoController.pesquisaProcesso()}"  >
                        <h:outputText value="#{controleDocumentoController.selected.tcmUsiId.usiProcesso}" converter="inputConverter" title="#{bundle.ListControleDocumentoTitle_usiProcesso}"/> 
                    </h:outputLink>

                    <h:outputLabel value="#{bundle.ViewControleDocumentoLabel_tcmProton}"/>                   
                    <h:outputLink styleClass="formataLink"  target="new" id="linkProton" value="#{controleDocumentoController.pesquisaProton()}" >
                        <h:outputText value="#{controleDocumentoController.selected.tcmProton}" converter="protonInputConverter" title="#{bundle.ViewControleDocumentoTitle_tcmProton}"/>
                    </h:outputLink> 

                    <h:outputLabel value="#{bundle.ViewControleDocumentoLabel_tcmDtCadastro}"/>
                    <h:outputText value="#{controleDocumentoController.selected.tcmDtCadastro}" title="#{bundle.ViewControleDocumentoTitle_tcmDtCadastro}">
                        <f:convertDateTime pattern="#{bundle.patternApp}" timeZone="#{filterSearchController.timeZone}"/>
                    </h:outputText>

                    <h:outputLabel value="#{bundle.ViewControleDocumentoLabel_orgaoUsina}"/>
                    <h:outputText value="#{controleDocumentoController.selected.tcmUsiId.usiOrgId.orgNm}" title="#{bundle.ViewControleDocumentoTitle_orgaoUsina}"/>
                    <ui:remove>
                        <h:outputText value="#{bundle.ViewControleDocumentoLabel_tcmDtAtualizacao}"/>
                        <h:outputText value="#{controleDocumentoController.selected.tcmDtExpedicao}" title="#{bundle.ViewControleDocumentoTitle_tcmDtAtualizacao}">
                            <f:convertDateTime pattern="#{bundle.patternApp}" timeZone="#{filterSearchController.timeZone}"/>
                        </h:outputText>
                    </ui:remove>                        
                    <h:outputLabel value="#{bundle.ViewControleDocumentoLabel_tcmUsiId}"/>
                    <h:outputText value="#{controleDocumentoController.selected.tcmUsiId.usiNm}" title="#{bundle.ViewControleDocumentoTitle_tcmUsiId}"/>

                    <h:outputLabel value="#{bundle.ViewControleDocumentoLabel_tcmTxNumero}"/>
                    <h:outputText value="#{controleDocumentoController.selected.tcmTxNumero}" converter="protonInputConverter" title="#{bundle.ViewControleDocumentoTitle_tcmTxNumero}"/>

                    <h:outputLabel value="#{bundle.ViewControleDocumentoLabel_tcmTdcId}"/>
                    <h:outputText value="#{controleDocumentoController.selected.tcmTdcId.tdcNm}" title="#{bundle.ViewControleDocumentoTitle_tcmTdcId}"/>

                    <h:outputLabel value="#{bundle.ViewControleDocumentoLabel_hdcTopId}"/>
                    <h:outputText value="#{controleDocumentoController.selected.tcmTopId.topNm}" title="#{bundle.ViewControleDocumentoTitle_hdcTopId}"/>

                    <h:outputLabel value="#{bundle.ViewControleDocumentoLabel_tcmSdcId}"/>
                    <h:outputText value="#{controleDocumentoController.selected.tcmSdcId.sdcNm}" title="#{bundle.ViewControleDocumentoTitle_tcmSdcId}"/>

                    <h:outputLabel value="#{bundle.ViewResponsavelLabel_rspAreId}"/>
                    <h:outputText value="#{controleDocumentoController.selected.tcmRspId.rspAreId.areNm}" title="#{bundle.ViewResponsavelTitle_rspAreId}"/>

                    <h:outputLabel value="#{bundle.ViewControleDocumentoLabel_tcmRspId}"/>
                    <h:outputText value="#{controleDocumentoController.selected.tcmRspId.rspNm}" title="#{bundle.ViewControleDocumentoTitle_tcmRspId}"/>

                    <ui:remove>
                        <h:outputText value="#{bundle.ViewControleDocumentoLabel_tcmIcObrigatorio}"/>
                        <h:outputText value="#{controleDocumentoController.selected.obrigatorio}" title="#{bundle.ViewControleDocumentoTitle_tcmIcObrigatorio}"/>
                    </ui:remove>
                    <h:outputLabel value="#{bundle.ViewControleDocumentoLabel_tcmTxObservacao}"/>
                    <h:outputText value="#{controleDocumentoController.selected.tcmTxObservacao}" title="#{bundle.ViewControleDocumentoTitle_tcmTxObservacao}"/>

                    <h:outputLabel id="labelNotaTecnica" value="#{bundle.HeaderPanelControleDocumento_notaTecnica}" rendered="#{controleDocumentoController.exibePanel}" />
                    <p:panel style="width: 800px;" id="panelNotaTecnica" header="#{bundle.HeaderPanelControleDocumento_notaTecnica}" rendered="#{controleDocumentoController.exibePanel}" >
                        <h:panelGrid columns="2">

                            <h:outputLabel value="#{bundle.ViewControleDocumentoLabel_tcmTxNumero}"/>

                            <h:outputText value="#{controleDocumentoController.notaTecnica.tcmTxNumero}" converter="protonInputConverter" title="#{bundle.ViewControleDocumentoTitle_tcmTxNumero}"/>

                            <h:outputLabel value="#{bundle.ViewControleDocumentoLabel_tcmDtCadastro}"/>
                            <h:outputText value="#{controleDocumentoController.notaTecnica.tcmDtCadastro}" title="#{bundle.ViewControleDocumentoTitle_tcmDtCadastro}">
                                <f:convertDateTime pattern="#{bundle.patternApp}" timeZone="#{filterSearchController.timeZone}"/>
                            </h:outputText>


                            <h:outputLabel value="#{bundle.ViewControleDocumentoLabel_tcmProton}"/>
                            <h:outputLink styleClass="formataLink" target="new" id="linkProtonNota" value="#{controleDocumentoController.pesquisaProtonNota()}" >
                                <h:outputText value="#{controleDocumentoController.notaTecnica.tcmProton}" converter="protonInputConverter" title="#{bundle.ViewControleDocumentoTitle_tcmProton}"/>
                            </h:outputLink>


                            <h:outputLabel value="#{bundle.ViewControleDocumentoLabel_tcmSdcId}"/>
                            <h:outputText value="#{controleDocumentoController.notaTecnica.tcmSdcId.sdcNm}" title="#{bundle.ViewControleDocumentoTitle_tcmSdcId}"/>

                            <h:outputLabel value="#{bundle.ViewControleDocumentoLabel_tcmTxConclusao}"/>
                            <h:outputText value="#{controleDocumentoController.notaTecnica.tcmTxObservacao}" title="#{bundle.ViewControleDocumentoTitle_tcmTxConclusao}"/>
                        </h:panelGrid>

                    </p:panel>

                    <h:outputLabel id="labelOficio" value="#{bundle.HeaderPanelControleDocumento_oficio}" rendered="#{controleDocumentoController.exibePanel}"/>
                    <p:panel style="width: 800px;" id="panelOficio" header="#{bundle.HeaderPanelControleDocumento_oficio}" rendered="#{controleDocumentoController.exibePanel}">      
                        <h:panelGrid columns="2">

                            <h:outputLabel value="#{bundle.ViewControleDocumentoLabel_tcmTxNumero}"/>

                            <h:outputText value="#{controleDocumentoController.oficio.tcmTxNumero}" converter="protonInputConverter" title="#{bundle.ViewControleDocumentoTitle_tcmTxNumero}"/>

                            <h:outputLabel value="#{bundle.ViewControleDocumentoLabel_tcmDtCadastro}"/>
                            <h:outputText value="#{controleDocumentoController.oficio.tcmDtCadastro}" title="#{bundle.ViewControleDocumentoTitle_tcmDtCadastro}">
                                <f:convertDateTime pattern="#{bundle.patternApp}" timeZone="#{filterSearchController.timeZone}"/>
                            </h:outputText>

                            <h:outputLabel value="#{bundle.ViewControleDocumentoLabel_tcmDtExpedicao}"/>
                            <h:outputText value="#{controleDocumentoController.oficio.tcmDtExpedicao}" title="#{bundle.ViewControleDocumentoTitle_tcmDtExpedicao}">
                                <f:convertDateTime pattern="#{bundle.patternApp}" timeZone="#{filterSearchController.timeZone}"/>
                            </h:outputText>

                            <h:outputLabel value="#{bundle.ViewControleDocumentoLabel_tcmProton}"/>
                            <h:outputLink styleClass="formataLink" target="new" id="linkProtonOficio" value="#{controleDocumentoController.pesquisaProtonOficio()}" >
                                <h:outputText value="#{controleDocumentoController.oficio.tcmProton}" converter="protonInputConverter" title="#{bundle.ViewControleDocumentoTitle_tcmProton}"/>
                            </h:outputLink>

                            <h:outputLabel value="#{bundle.ViewControleDocumentoLabel_tcmSdcId}"/>
                            <h:outputText value="#{controleDocumentoController.oficio.tcmSdcId.sdcNm}" title="#{bundle.ViewControleDocumentoTitle_tcmSdcId}"/>

                            <h:outputLabel value="#{bundle.ViewControleDocumentoLabel_tcmTxObservacao}"/>
                            <h:outputText value="#{controleDocumentoController.oficio.tcmTxObservacao}" title="#{bundle.ViewControleDocumentoTitle_tcmTxObservacao}"/>
                        </h:panelGrid>

                    </p:panel>

                    <h:outputLabel value="#{bundle.createBy}" for="nomeCriador" rendered="#{not empty controleDocumentoController.selected.historicoCriacao.nomeUsuario}"/>
                    <h:outputText id="nomeCriador" value="#{controleDocumentoController.selected.historicoCriacao.nomeUsuario}" rendered="#{not empty controleDocumentoController.selected.historicoCriacao.nomeUsuario}"/>
                    <h:outputLabel value="#{bundle.createDate}" for="dataCriacao" rendered="#{not empty controleDocumentoController.selected.historicoCriacao.dataHora}"/>
                    <h:outputText id="dataCriacao" value="#{controleDocumentoController.selected.historicoCriacao.dataHora}" rendered="#{not empty controleDocumentoController.selected.historicoCriacao.dataHora}"/>     
                    <h:outputLabel value="#{bundle.updateBy}" for="nomeAlterador" rendered="#{not empty controleDocumentoController.selected.historicoAlteracao.nomeUsuario}"/>
                    <h:outputText id="nomeAlterador" value="#{controleDocumentoController.selected.historicoAlteracao.nomeUsuario}" rendered="#{not empty controleDocumentoController.selected.historicoAlteracao.nomeUsuario}"/>
                    <h:outputLabel value="#{bundle.updateDate}" for="dataAlteracao" rendered="#{not empty controleDocumentoController.selected.historicoAlteracao.dataHora}"/>
                    <h:outputText id="dataAlteracao" value="#{controleDocumentoController.selected.historicoAlteracao.dataHora}" rendered="#{not empty controleDocumentoController.selected.historicoAlteracao.dataHora}" /> 

                </h:panelGrid>
                <br />

                <p:commandButton id="deleteCommand" rendered="#{autenticadorController.loginAdmin}"  onclick="confirmationDestroy.show()" value="#{bundle.ViewControleDocumentoDestroyLink}" type="button" icon="#{bundle.icone_lixeira}" />&nbsp;
                <p:commandButton ajax="false" rendered="#{!autenticadorController.loginVisualizador}" icon="#{bundle.icone_pencil}"  action="#{controleDocumentoController.prepareEdit}" value="#{bundle.ViewControleDocumentoEditLink}"/> &nbsp;                    
                <p:commandButton ajax="false" action="#{controleDocumentoController.prepareListaDocumentos}" icon="#{bundle.icone_listar}" value="#{bundle.ViewControleDocumentoShowAllLink}" immediate="true"/>                    

            </p:panel>

            <p:confirmDialog id="confirmDestroy" message="#{bundle.MsgConfirmDestroy_message}" header="#{bundle.MsgConfirmDestroy_header}" severity="alert" widgetVar="confirmationDestroy">
                <p:commandButton id="confirm" ajax="false" value="#{bundle.MsgDialog_confirmar}"  oncomplete="confirmationDestroy.hide();" action="#{controleDocumentoController.destroy}" />
                <p:commandButton id="decline"  value="#{bundle.MsgDialog_cancelar}" update="messages" onclick="confirmationDestroy.hide()" type="button"/>
            </p:confirmDialog>

            <!--</h:form>-->
        </ui:define>
    </ui:composition>

</html>
